home *** CD-ROM | disk | FTP | other *** search
/ Transactor / Transactor_18_1987_Transactor_Publishing.d64 / palvert64 1.0 (.txt) < prev    next >
Commodore BASIC  |  2023-02-26  |  5KB  |  129 lines

  1. 20 rem ****************************************
  2. 30 rem * convert cbm assembler source file to *
  3. 40 rem *  file to pal assembler source file   *
  4. 50 rem *         k.j.h. hildon 03/83          *
  5. 60 rem *   =======  palvert64 1.0 =========   *
  6. 70 rem *       works on c64 with disk         *
  7. 80 rem * absolutely no copyright restrictions *
  8. 90 rem ****************************************
  9. 100 i$="abcdefghijklmnopqrstuvwxyz1234" : rem i$ must be 1st var used
  10. 110 i$=i$+i$+i$                         : rem establish input buffer
  11. 120 mc=896                              : rem mach code start addr
  12. 130 rem *** string input routine -- by jim butterfield ***
  13. 140 data 160,   2, 177,  45, 153, 137,   0, 200, 192,   6, 208, 246, 162,   1
  14. 150 data  32, 198, 255,  32, 228, 255, 201,  13, 240,  15, 164, 142, 145, 140
  15. 160 data 200, 132, 142, 196, 139, 240,   4, 165, 144, 240, 234,  76, 204, 255
  16. 170 restore : for j=mc to mc+41 : read x : poke j, x : t=t+x : next
  17. 180 if t<>6120 then print"typo in data" : stop
  18. 190 z$=chr$(0) : cd=8 : pd=8 : od=8 : cn=0 : print chr$(14)
  19. 200 sa=2049                             : rem start addr c64
  20. 210 sl=100                              : rem starting line #
  21. 220 ic=10                               : rem increment
  22. 230 gosub 270
  23. 240 print : input "append to existing pal file (y/n)";yn$
  24. 250 if yn$="y" then 900
  25. 260 gosub 360 : gosub 450 : goto 520
  26. 270 print : input "cbm source filename";cn$
  27. 280 print tab(20)cn"[145]"
  28. 290 input "       source drive";cn
  29. 300 print tab(20)cd"[145]"
  30. 310 input "     source device#";cd
  31. 320 cn$=mid$(str$(cn),2)+":"+cn$
  32. 330 open 1, cd, 8, cn$ : ed=cd : gosub 700 : close 1
  33. 340 if e then print ee$ : print : goto 270
  34. 350 return
  35. 360 print : input "   new pal filename";pn$
  36. 370 print tab(20)cn"[145]"
  37. 380 input "  destination drive";pn
  38. 390 print tab(20)pd"[145]"
  39. 400 input "destination device#";pd
  40. 410 pn$=mid$(str$(pn),2)+":"+pn$
  41. 420 open 2, pd, 6, pn$ : ed=pd : gosub 700 : close 2
  42. 430 if e<>62 then print "file exists" : print : goto 360
  43. 440 print : return
  44. 450 a=sl : print : print tab(20)sl"[145]"
  45. 460 input "    starting line #";sl
  46. 470 if sl<a then print"must be > or = !" : sl=a : goto 450
  47. 480 print tab(20)ic"[145]"
  48. 490 input "     line increment";ic
  49. 500 print : return
  50. 510 rem ** open input and output files **
  51. 520 open 1, cd, 8, cn$
  52. 530 open 2, pd, 6, pn$+",p,w"
  53. 540 a=sa : gosub 660     : rem output file start addr ($0801)
  54. 550 sys mc : sx=st       : rem input line from cbm source file
  55. 560 a$=left$(i$,peek(142))
  56. 570 sa=sa+len(a$)+5      : rem start addr + line len + 5 for link,line,mkr
  57. 580 a=sa : gosub 660     : rem output line link - hex lo, hex hi
  58. 590 a=sl : gosub 660     : rem output line #    - hex lo, hex hi
  59. 600 printsl;a$    : rem ===== remove for better speed ======
  60. 610 sl=sl+ic             : rem increment line number
  61. 620 print#2, a$z$;       : rem output line, chr$ zero
  62. 630 if sx=0 then 550
  63. 640 close 2 : close 1 : goto 760
  64. 650 ** output 2 hex bytes **
  65. 660 print#2, chr$(a and 255);
  66. 670 print#2, chr$(int(a/256));
  67. 680 return
  68. 690 ** error input **
  69. 700 open 15, ed, 15
  70. 710 input#15, e, e$, et, es
  71. 720 ee$=str$(e)+","+e$+","+ str$(et)+","+str$(es)
  72. 730 close 15
  73. 740 return
  74. 750 rem ** add more cbm source modules **
  75. 760 print
  76. 770 print "([196][207] [206][207][212] exit with <[210][197][212][213][210][206]>)
  77. 775 [133]"atnppend another file ncmdcmdcmd";yn$
  78. 780 [139] yn$[178]"y" [167] 840
  79. 790 [159] 2, pd, 6, pn$[170]",a"
  80. 800 [152]2, z$z$;             : [143] add end file marker ($00, $00)
  81. 810 [160] 2 : [160] 15
  82. 820 [153] "load";[199](34);pn$;[199](34);","[202]([196](pd),2)"ononon"
  83. 830 [128]
  84. 840 [141] 270                  : [143] for new cbm file name
  85. 850 [141] 450                  : [143] alter next line number, increment
  86. 860 [159] 1, cd, 8, cn$
  87. 870 [159] 2, pd, 6, pn$[170]",a"
  88. 880 [137] 550                   : [143] go add file
  89. 890 [143] ** append cbm source to existing pal file **
  90. 900 [153] : [133] "   old pal filename";op$
  91. 910 [153] [163]20)cn"on"
  92. 920 [133] "              drive";op
  93. 930 [153] [163]20)od"on"
  94. 940 [133] "            device#";od
  95. 950 [159] 1, od, 8, op$ : ed[178]od : [141] 700 : [160] 1
  96. 960 [139] e [167] [153] ee$ : [153] : [137] 900
  97. 970 [153] : [153] [163]21)"@"op$"on"
  98. 980 [133] "   new pal filename";pn$
  99. 990 [139] [200](pn$,1)[179][177]"@" [167] 1010
  100. 1000 pn[178]op : pd[178]od : pn$[178]"@"[170][202]([196](pn),2)[170]":"[170][202](pn$,2) : [137] 1080
  101. 1010 [153] [163]20)cn"on"
  102. 1020 [133] "  destination drive";pn
  103. 1030 [153] [163]20)pd"on"
  104. 1040 [133] "destination device#";pd
  105. 1050 pn$[178][202]([196](pn),2)[170]":"[170]pn$
  106. 1060 [159] 2, pd, 6, pn$ : ed[178]pd : [141] 700 : [160] 2
  107. 1070 [139] e[179][177]62  [167] [153] " file exists" : [153] : [137] 970
  108. 1080 [153] : [153]"creating new file from ";op$;"  stand by..."
  109. 1090 [159] 1, od, 8, op$[170]",p,r"
  110. 1100 [159] 2, pd, 6, pn$[170]",p,w"
  111. 1110 [161]#1,a$ : [152]2, [199]([198](a$[170]z$));   : [143] file start address
  112. 1120 [161]#1,a$ : [152]2, [199]([198](a$[170]z$));
  113. 1130 [161]#1, b$, c$ : [139] st[178]64  [167] 1230     : [143] get line link
  114. 1140 a$[178][199]([198](b$[170]z$)) [170] [199]([198](c$[170]z$))
  115. 1150 [161]#1, b$, c$                           : [143] get line number
  116. 1160 a$[178]a$ [170] [199]([198](b$[170]z$)) [170] [199]([198](c$[170]z$))
  117. 1170 [151] mc[170]21, 0                           : [143] input delim now $00
  118. 1180 [158] mc
  119. 1190 a$[178]a$[170][200](i$,[194](142))[170]z$            : [143] +z$ to add lost mkr
  120. 1200 [152]2,a$;
  121. 1210 sa[178]sa[170][195](a$)                           : [143] update start addr
  122. 1220 [137] 1130
  123. 1230 [160] 1
  124. 1240 [151] mc[170]21, 13                          : [143] input delim back to cr
  125. 1250 sl[178][198]([202](a$,3)[170]z$)[170][198]([202](a$,4)[170]z$)[172]256[170]ic
  126. 1260 [141] 450                               : [143] alter next line num
  127. 1270 [159] 1, cd, 8, cn$[170]",s,r"
  128. 1280 [137] 550
  129.